import m,requests,time
import multiprocessing as mp

def cell(token,cid,un):
    for _ in range(500):
        try:
            list=m.getnodelist(token,cid)
            break
        except Exception as e:
            time.sleep(1)
    m.playall(token,list,'20',un)

if __name__ == '__main__':
    un=input("学号：")
    print('=================================================================')
    for _ in range(100):
       try:
           token=m.login(un,'123456a','12656')[1:]
           break
       except Exception as e:
           print(e)
    print(token)
    print('=================================================================')
    l=m.getlist(token)
    for data in l:
        print(data)
    print('=================================================================')
    for data in l:
        cid=data['courseOpenId']
        s = mp.Process(target=cell,args=(token,cid,un))
        s.start()